<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .left {
        float: left;
        width: 100px;
        height: 300px;
        background: red;
      }
      /* 右侧元素设置overflow: hidden;
            这样右边就触发了BFC，BFC的区域不会与浮动元素发生重叠，所以两侧就不会发生重叠。 */
      .right {
        overflow: hidden;
        height: 300px;
        background: green;
      }
    </style>
  </head>
  <body>
    <div class="left"></div>
    <div class="right"></div>
  </body>
</html>
